﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using MovieBrowser.Model;

namespace MovieBrowser.Presentation.Forms.Dialogs
{
    public partial class SelectMovie : Form
    {
        public string SelectedLocation { get; set; }

        public SelectMovie(Movie movie, IEnumerable<MovieFilesystem> filesystems)
        {
            InitializeComponent();
            label2.Text = movie.Title;
            objectListView1.SetObjects(filesystems);
        }

        private void CommandLink1Click(object sender, EventArgs e)
        {
            SelectedLocation = ((MovieFilesystem)objectListView1.SelectedObject).FolderPath;
            Close();
        }

        private void CommandLink2Click(object sender, EventArgs e)
        {
            SelectedLocation = null;
            Close();
        }

        private void ObjectListView1DoubleClick(object sender, EventArgs e)
        {
            SelectedLocation = ((MovieFilesystem)objectListView1.SelectedObject).FolderPath;
            Close();
        }
    }
}
